package week5;

public class Ex45 {
    public static void main(String[] args) {
        long p;
        for (int i = 144; ; ++i){
            p = i * (2L * i - 1);
            if ((1 + Math.sqrt(1 + 24 * p)) % 6 == 0){
                System.out.println(p);
                break;
            }
        }
    }
}
